from openpyxl import load_workbook


def write():
    num_list = [1, 2, 3, 4, 5, 6]

    book = load_workbook(filename=r"企业纳税人识别号.xlsx")
    # 读取名字为Sheet1的表
    sheet = book["Sheet1"]
    for i in range(1, len(num_list) + 1):
        sheet.cell(i, 4, num_list[i - 1])  # sheet.cell(1,1,num_list[0])表示将num_list列表的第0个数据1写入到excel表格的第一行第一列
    book.save("企业纳税人识别号2.xlsx")  # 对文件进行保存


write()